package simulation;

public class CarSpecs implements ICarSpecs {
    protected String brand;	
    protected String model;
    protected double powerConsumptionAtStartup = 0;
    private double batteryCapacity;
    private double minimumBatteryCharge;
    protected double powerConsumptionPerKilometer; // Efficiency        
    private double chargingEfficiency = 0.93;
    private double dischargingEfficiency = 0.93;
    private double maxChargePerHour = 4; // 3 kW per Hour 

    @Override
    public String getBrand() {
        return brand;
    }
    public void setBrand(String brand) {
        this.brand = brand;
    }
    
    @Override
    public double getBatteryCapacity() {
        return batteryCapacity;
    }
    public void setBatteryCapacity(double batteryCapacity) {
        this.batteryCapacity = batteryCapacity;
    }
    
    @Override
    public double getPowerConsumptionPerKilometer() {
        return powerConsumptionPerKilometer;
    }
    
    public void setPowerConsumptionPerKilometer(double powerConsumptionPerKilometer) {
        this.powerConsumptionPerKilometer = powerConsumptionPerKilometer;
    }
    
    @Override
    public String getModel() {
        return model;
    }
    public void setModel(String model) {
        this.model = model;
    }
    
    @Override
    public double getPowerConsumptionAtStartup() {
        return powerConsumptionAtStartup;
    }
    public void setPowerConsumptionAtStartup(double powerConsumptionAtStartup) {
        this.powerConsumptionAtStartup = powerConsumptionAtStartup;
    }


    /**
     * @return the minimumCharge
     */
    @Override
    public double getMinimumBatteryCharge() {
        return minimumBatteryCharge;
    }

    void setMinimumBatteryCharge(double charge) {
        this.minimumBatteryCharge = charge;
    }
    
    
    @Override
    public String toString(){
        return  "Brand: " + this.getBrand() + CommonResources.STRING_SEPARATOR + 
                "Model: " + this.getModel()+ CommonResources.STRING_SEPARATOR+ 
                "Min: " + this.getMinimumBatteryCharge() + CommonResources.STRING_SEPARATOR + 
                "Max: " + this.getBatteryCapacity() + CommonResources.STRING_SEPARATOR +                 
                "km per kW: " + this.getPowerConsumptionPerKilometer() + CommonResources.STRING_SEPARATOR +
                "Startup: " + this.getPowerConsumptionAtStartup();
    }

    @Override
    public double getMaxChargingPerSlot(int slotSize) {
        double timeScale = (double)slotSize / (double)CommonResources.DEFAULT_INTERVAL;
        // TODO: This has to adjusted, it must multiply by the max amount of power
        return this.maxChargePerHour*timeScale*this.chargingEfficiency; // Maxcharge per slot: this should be calculated
    }

    /**
     * @return the chargingEfficiency
     */
    @Override
    public double getChargingEfficiency() {
        return chargingEfficiency;
    }

    /**
     * @param chargingEfficiency the chargingEfficiency to set
     */
    @Override
    public void setChargingEfficiency(double chargingEfficiency) {
        this.chargingEfficiency = chargingEfficiency;
    }

    /**
     * @return the dischargingEfficiency
     */
    @Override
    public double getDischargingEfficiency() {
        return dischargingEfficiency;
    }

    /**
     * @param dischargingEfficiency the dischargingEfficiency to set
     */
    @Override
    public void setDischargingEfficiency(double dischargingEfficiency) {
        this.dischargingEfficiency = dischargingEfficiency;
    }
}
